package org.iteam.web.shiro;

import org.apache.shiro.SecurityUtils;
import org.apache.shiro.subject.Subject;

public class ShiroUtil {
	/**
	 * 获取当前登录帐号
	 * 
	 * @return
	 */
	public static String currentAccount() {
		Subject currentUser = SecurityUtils.getSubject();
		if (currentUser != null)
			return currentUser.getPrincipal() == null ? null : currentUser
					.getPrincipal().toString();
		else
			return null;
	}

	public static boolean isAuthenticated() {
		Subject currentUser = SecurityUtils.getSubject();
		return currentUser.isAuthenticated();
	}
}
